import { FormattedMessage } from 'umi';
import { Badge } from 'antd';

export const RestartPolicy = {
  Always: {
    text: <FormattedMessage id="enum.restartPolicy.always" defaultMessage="总是重启" />,
    value: 'Always'
  },
  OnFailure: {
    text: <FormattedMessage id="enum.restartPolicy.OnFailure" defaultMessage="失败时重启" />,
    value: 'OnFailure'
  },
  Never: {
    text: <FormattedMessage id="enum.restartPolicy.Never" defaultMessage="不重启" />,
    value: 'Never'
  }
};

export const AppFunctionType = {
  process: <FormattedMessage id='pages.application.model.functionType.process' defaultMessage='数据处理' />,
};

export const NodeStatus = {
  Offline: {
    text: (
      <FormattedMessage id="enum.nodeStatus.offline" defaultMessage="已下线" />
    ),
    status: 'Offline',
    color: '#999'
  },
  Online: {
    text: (
      <FormattedMessage id="enum.nodeStatus.online" defaultMessage="已上线" />
    ),
    status: 'Online',
    color: '#52c41a'
  },
  NotInstalled: {
    text: (
      <FormattedMessage id="enum.nodeStatus.NotInstalled" defaultMessage="未安装" />
    ),
    status: 'NotInstalled',
    color: '#ff4d4f'
  },
  Deleting: {
    text: (
      <FormattedMessage id="enum.nodeStatus.Deleting" defaultMessage="下线中" />
    ),
    status: 'Deleting',
    color: 'red'
  },
  length: 3
};

export const InstanceStatus = {
  Init: {
    text: (
      <FormattedMessage id="enum.InstanceStatus.Init" defaultMessage="初始化中" />
    ),
    status: 'Init',
    color: '#999'
  },
  Deploying: {
    text: (
      <FormattedMessage id="enum.InstanceStatus.Deploying" defaultMessage="部署中" />
    ),
    status: 'Deploying',
    color: '#52c41a'
  },
  Running: {
    text: (
      <FormattedMessage id="enum.InstanceStatus.Running" defaultMessage="运行中" />
    ),
    status: 'Running',
    color: '#52c41a'
  },
  Abnormal: {
    text: (
      <FormattedMessage id="enum.InstanceStatus.Abnormal" defaultMessage="异常" />
    ),
    status: 'Abnormal',
    color: '#999'
  },
  UpdateInit: {
    text: (
      <FormattedMessage id="enum.InstanceStatus.UpdateInit" defaultMessage="升级中" />
    ),
    status: 'UpdateInit',
    color: '#ff4d4f'
  },
  Deleting: {
    text: (
      <FormattedMessage id="enum.InstanceStatus.Deleting" defaultMessage="删除中" />
    ),
    status: 'Deleting',
    color: '#ff4d4f'
  },
};

export const VersionStatus = {
  Published: {
    text: (
      <FormattedMessage id="enum.nodeStatus.offline" defaultMessage="已发布" />
    ),
    status: 'Published',
    color: '#52c41a'
  },
  Unpublished: {
    text: (
      <FormattedMessage id="enum.nodeStatus.online" defaultMessage="未发布" />
    ),
    status: 'Unpublished',
    color: '#999'
  },
  Offline: {
    text: (
      <FormattedMessage id="enum.nodeStatus.offline" defaultMessage="已下线" />
    ),
    status: 'Offline',
    color: '#999'
  },
};



export const ArchType = {
  aarch64: {
    text: <FormattedMessage id="enum.archType.aarch64" defaultMessage="aarch64" />,
    type: 'aarch64'
  },
  arm64: {
    text: <FormattedMessage id="enum.archType.arm64" defaultMessage="arm64" />,
    type: 'arm64'
  },
};

export const NetworkType = {
  Host: {
    label: <FormattedMessage id="enum.networkType.Host" defaultMessage="主机网络" />,
    value: 'Host'
  },
  PortMapping: {
    label: <FormattedMessage id="enum.networkType.PortMapping" defaultMessage="端口映射" />,
    value: 'PortMapping'
  }
};

export const BatchJObStatus = {
  waiting: {
    text: <><Badge status='processing' /><FormattedMessage id='Waiting' defaultMessage='等待中' /></>,
    value: 'waiting'
  },
  installing: {
    text: <><Badge status='processing' /><FormattedMessage id='installing' defaultMessage='安装中' /></>,
    value: 'installing'
  },
  finish: {
    text: <><Badge status='success' /><FormattedMessage id='finish' defaultMessage='完成' /></>,
    value: 'finish'
  },
  error: {
    text: <><Badge status='error' /><FormattedMessage id='error' defaultMessage='错误' /></>,
    value: 'error'
  }
};